package jmine.tec.web.wicket.component.command.img;

import images.ImageResources;

import java.io.Serializable;

import org.apache.wicket.Page;
import org.apache.wicket.ResourceReference;

/**
 * {@link ImageCommand} que representa um botão de visualização.
 * 
 * @author Rafael Volpato
 * @date Aug 2, 2011
 */
public class ViewCommand extends AbstractImageCommand {

    private ViewCommandHandler handler;

    /**
     * Construtor.
     * 
     * @param handler {@link ViewCommandHandler}
     */
    public ViewCommand(ViewCommandHandler handler) {
        this.handler = handler;
    }

    /**
     * {@inheritDoc}
     */
    public ResourceReference getImage() {
        return new ResourceReference(ImageResources.class, "view.png");
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Page execute(Serializable entityPk) {
        return this.handler.createViewPage(entityPk);
    }
}
